package com.briup.mt.service.impl;
        import com.briup.mt.bean.BaseLog;
        import com.briup.mt.bean.BaseLogExample;
        import com.briup.mt.dao.BaseLogMapper;
        import com.briup.mt.service.IBaseLogService;
        import org.springframework.stereotype.Service;
        import org.springframework.util.StringUtils;

        import javax.annotation.Resource;
        import java.util.List;
@Service
public class BaseLogServiceImpl implements IBaseLogService {
    @Resource
    private BaseLogMapper baseLogMapper;

    @Override
    public List<BaseLog> query(Long id) {
        BaseLogExample example=new BaseLogExample();
        if(!StringUtils.isEmpty(id)){
            example.createCriteria().andIdEqualTo(id);
        }
        List<BaseLog> list=baseLogMapper.selectByExample(example);
        return list;
    }

    @Override
    public void saveOrUpdate(BaseLog baseLog) {
        if(baseLog.getId()==null){
            baseLogMapper.insert(baseLog);
        }else{
            baseLogMapper.updateByPrimaryKey(baseLog);
        }
        baseLogMapper.insert(baseLog);
    }

    @Override
    public void deleteById(long id) {
        baseLogMapper.deleteByPrimaryKey(id);
    }
}